package com.cn.bulu.utils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class MapToStringUtil {

	
	public static String transMapToString(Map<String, String> map) {
		StringBuffer content = new StringBuffer();
		List<String> keys = new ArrayList<String>(map.keySet());
		Collections.sort(keys);
		for (int i = 0; i < keys.size(); i++) {
			String key = keys.get(i);
			String value = map.get(key);
			content.append((i == 0 ? "" : "&") + key + "=" + value);
		}
		
		return  content.toString();
	}

}
